home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / aros / source / exec / src / execbase.c < prev   
Encoding:
C/C++ Source or Header  |  1996-07-16  |  1.6 KB  |  70 lines

  1. /*
  2.     $Id$
  3.     $Log$
  4. */
  5.  
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include "exec_intern.h"
  9. #include <clib/aros_protos.h>
  10. #include <aros/lvo.h>
  11.  
  12. #define NUM_EXEC_LVOS 130
  13.  
  14. struct
  15. {
  16.     LVEntry        el_LVO[NUM_EXEC_LVOS];
  17.     struct ExecBase el_LibBase;
  18. } ExecLibrary;
  19.  
  20. #include "inittable.h"
  21.  
  22. struct ExecBase * ExecBase = &ExecLibrary.el_LibBase;
  23.  
  24.  
  25. void __AROS_Unsupported (struct Library * lib)
  26. {
  27.     fprintf (stderr, "An Unsupported Function has been called for %08lx\n"
  28.     , lib);
  29.     exit (100); /* Alert() ? */
  30. } /* __AROS_Unsupported */
  31.  
  32. void __AROS_InitExecBase (void)
  33. {
  34.     LVEntry * entry;
  35.     int       t;
  36.  
  37.     entry = (LVEntry *)ExecBase;
  38.  
  39.     for (t=-1; t>=-NUM_EXEC_LVOS; t--)
  40.     {
  41.     entry->lve_Jmp       = M68k_JMP;
  42.     entry->lve_FuncPtr = (APTR)__AROS_Unsupported;
  43.     }
  44.  
  45.     for (t=0; t<(sizeof (InitTable)/sizeof (InitTable[0])); t++)
  46.     {
  47.     entry = __AROS_LVO_GET(ExecBase,InitTable[t].it_Offset);
  48.  
  49.     entry->lve_FuncPtr = InitTable[t].it_Func;
  50.     }
  51.  
  52.     /* Initialize the lib-base by hand */
  53.     ExecBase->LibNode.lib_Flags    = 0;
  54.     ExecBase->LibNode.lib_pad       = 0;
  55.     ExecBase->LibNode.lib_NegSize  = NUM_EXEC_LVOS * LIB_VECTSIZE;
  56.     ExecBase->LibNode.lib_PosSize  = sizeof (struct ExecBase)
  57.     - sizeof (struct Library);
  58.     ExecBase->LibNode.lib_Version  = 40;
  59.     ExecBase->LibNode.lib_Revision = 70;
  60.     ExecBase->LibNode.lib_IdString = "exec.library";
  61.     ExecBase->LibNode.lib_Sum       = 0L;
  62.     ExecBase->LibNode.lib_OpenCnt  = 1L; /* Never try to expunge */
  63.  
  64.     /* Calculate the checksum */
  65.     ExecBase->LibNode.lib_Sum = CalcChecksum (&ExecLibrary
  66.     , sizeof (ExecLibrary));
  67.  
  68. } /* __AROS_InitExecBase */
  69.  
  70.